<template>
  <div>
    <!-- 导航链接 -->
    <div class="nav-links">
      <router-link to="/">滨海</router-link> |
      <router-link to="/chashan">茶山</router-link> |
      <router-link to="/yueqing">乐清</router-link> |
      <router-link to="/system">学生管理系统</router-link>
    </div>

    <h1 class="center-text">温州理工滨海校区</h1>

    <!-- 学号输入框和搜索按钮 -->
    <div class="search-box">
      <input v-model="studentId" placeholder="输入学号">
      <button @click="searchStudent">搜索</button>
    </div>

    <!-- 学生信息展示 -->
    <div v-if="studentInfo" class="student-info">
      <p><strong>学生信息</strong></p>
      <p>学号: {{ studentInfo.studentId }}</p>
      <p>姓名: {{ studentInfo.name }}</p>
      <p>年龄: {{ studentInfo.age }}</p>
      <p>专业: {{ studentInfo.major }}</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      studentId: '',
      studentInfo: null
    };
  },
  methods: {
    searchStudent() {
      // 模拟数据
      const mockData = {
        '123456': {
          studentId: '123456',
          name: '李小明',
          age: 18,
          major: '计算机科学'
        }
      };

      this.studentInfo = mockData[this.studentId] || null;
    }
  }
};
</script>

<style scoped>
.nav-links {
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.2em; /* 字体稍微变大 */
  font-weight: bold; /* 字体加粗 */
}

.nav-links a {
  text-decoration: none; /* 去掉链接下划线 */
  color: blue; /* 将颜色还原为蓝色 */
}

.center-text {
  text-align: center;
  font-weight: normal; /* 去掉加粗样式 */
}

.search-box {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.search-box input {
  padding: 8px;
  margin-right: 10px;
}

.search-box button {
  padding: 8px 16px;
}

.student-info {
  text-align: center;
  margin-top: 20px;
}
</style>